//
//  Constants.swift
//  QNN
//
//  Created by zhenyu on 17/3/30.
//  Copyright © 2017年 qianshengqian. All rights reserved.
//

import UIKit
import Extension

/**
 
 *******************************************************
 *                       颜色                           *
 *******************************************************
 
 */

struct Color {
  /// 主题颜色
  static let theme = UIColor(hexString: "004D83")
  /// 按钮高亮
  static let btnHlight = UIColor(hexString: "004D83")
  /// 按钮默认
  static let btnNormal = UIColor(hexString: "DBDBDB")
  /// 字体颜色
  static let font = UIColor(hexString: "5A595E")
  /// 轻字体颜色
  static let lightFont = UIColor(hexString: "97969B")
  /// 分割线颜色
  static let line = UIColor(hexString: "E3E3E3")
  /// 背景颜色
  static let back = UIColor(hexString: "EFEFF9")
}




/**
 
 *******************************************************
 *                       字体                           *
 *******************************************************
 
 */

struct Font {
  /// 数字字体
  static let numFont = "Avenir"
  /// 数字加粗字体
  static let numBoldFont = "Avenir-Medium"
  /// 数字heavy字体
  static let numHeavyFont = "Avenir-Heavy"
}

// 字体
func HRFont(name: String = "", size: CGFloat, bold: Bool = false) -> UIFont {
  var font: UIFont!
  if name.length > 0 {
    font = UIFont(name: name, size: size)
  } else {
    font = bold ? UIFont.boldSystemFont(ofSize: size) : UIFont.systemFont(ofSize: size)
  }
  return font
}

/// 适配字体
func HRFontt(name: String = "", size: CGFloat, bold: Bool = false) -> UIFont {
  var font: UIFont!
  
  // 4、5机型上字体大小缩小两号
  let fontSize = iPhone_4_5 ? size - 2 : size
  
  if name.length > 0 {
    font = UIFont(name: name, size: fontSize)
  } else {
    font = bold ? UIFont.boldSystemFont(ofSize: fontSize) : UIFont.systemFont(ofSize: fontSize)
  }
  return font
}



/**
 
 *******************************************************
 *                       通知                           *
 *******************************************************
 
 */

struct QNNNotification {
  /// 图形验证码验证成功
  static let TCWebCodeSuccess = NSNotification.Name(rawValue: "TCWebCodeSuccess")
}
